package org.come.until;

import java.math.BigDecimal;

import org.come.entity.Goodstable;
import org.come.entity.RoleSummoning;

public class PetScoreUtil {
	public static int[] ptskillList = {24003,24004,24007,24008,24010,24012,24013,24014,24015,24017,24020,24021,24022,24023,24024,24025};
	public static int[] gjskillList = {24027,24028,24030,24031,24032,24034,24035,24037,24038,24039,24040,24043,24045,24046,24047,24048};
	public static void main(String[] args) {
		

	}

	
	
	public static String addCountPetScore(RoleSummoning pet) {
		
		String petScore = "0";
		long zl = 0;
		//龙骨计算
		if(pet.getDragon()>0) {
			zl = zl+pet.getDragon()*50;
		}
		//亲密值
		if(pet.getFriendliness()>0) {
			zl = zl+pet.getFriendliness()/1000;
		}
		//召唤兽等级
		if(pet.getGrade()!=null) {
			zl = zl+JmSum.MZ(pet.getGrade())*25;
		}
		//召唤兽技能开格子
		if(pet.getOpenSeal()>0) {
			zl = zl+pet.getOpenSeal()*1500;
		}
		//召唤兽升星
		if(pet.getFragment()>0) {
			zl = zl+pet.getFragment()*1500;
		}

		if(pet.getBeastSkills()!=null && pet.getBeastSkills()!="") {
			zl = zl+15000;
		}
		//炼妖抗性
		if(pet.getLyk()!=null) {
			String[] lyks = pet.getLyk().split("\\|");
			if(lyks!=null) {
				for(String lyk:lyks) {
					if(lyk!=null) {
						if(lyk.split("=")[0].equals("抗混乱")) {
							zl = (long) (zl+Double.parseDouble(lyk.split("=")[1])*30);
						}else if(lyk.split("=")[0].equals("物理吸收")) {
							zl = (long) (zl+Double.parseDouble(lyk.split("=")[1])*15);
						}else if(lyk.split("=")[0].equals("抗封印")) {
							zl = (long) (zl+Double.parseDouble(lyk.split("=")[1])*30);
						}else if(lyk.split("=")[0].equals("抗遗忘")) {
							zl = (long) (zl+Double.parseDouble(lyk.split("=")[1])*30);
						}else if(lyk.split("=")[0].equals("抗昏睡")) {
							zl = (long) (zl+Double.parseDouble(lyk.split("=")[1])*30);
						}
//						else {
//							zl = (long) (zl+Double.parseDouble(lyk.split("=")[1])*2);
//						}
					}
				}
			}
		}
		//原始抗性
		if(pet.getResistance()!=null) {
			String[] lyks = pet.getResistance().split("\\|");
			for(String lyk:lyks) {
				if(!lyk.isEmpty()) {
					if(lyk.split("=")[0].equals("抗混乱")) {
						zl = (long) (zl+Double.parseDouble(lyk.split("=")[1])*30);
					}else if(lyk.split("=")[0].equals("物理吸收")) {
						zl = (long) (zl+Double.parseDouble(lyk.split("=")[1])*15);
					}else if(lyk.split("=")[0].equals("抗封印")) {
						zl = (long) (zl+Double.parseDouble(lyk.split("=")[1])*30);
					}else if(lyk.split("=")[0].equals("抗遗忘")) {
						zl = (long) (zl+Double.parseDouble(lyk.split("=")[1])*30);
					}else if(lyk.split("=")[0].equals("抗昏睡")) {
						zl = (long) (zl+Double.parseDouble(lyk.split("=")[1])*30);
					}else {
						zl = (long) (zl+Double.parseDouble(lyk.split("=")[1])*2);
					}
				}
			}
		}
		//领悟的技能
		if(pet.getPetSkills()!=null) {
			String[] jns = pet.getPetSkills().split("\\|");
			if(jns.length>0) {
				for(String string:jns) {
					if(string!=null) {
						int Id = Integer.parseInt(string);
						if ((Id>=1606&&Id<=1608)||(Id>=1828&&Id<=1830)||(Id>=1840&&Id<=1842)||(Id>=1867&&Id<=1869)||Id==3034 || Id==450027) {//终极技能
							zl = zl + 50000;
						}else if ((Id>=1815&&Id<=1827)||(Id>=1600&&Id<=1605)||(Id>=1610&&Id<=1612)||Id==1811||Id==1831||Id==1833||Id==1890||Id==1887||(Id>=1871&&Id<=1880)) {//高级技能
							zl = zl + 6000;
						}else {
							zl = zl + 3000;
						}
					}
				}
			}
		}
		if(pet.getSkill()!=null) {
			String[] jns = pet.getSkill().split("\\|");
			if(jns.length>0) {
				for(String string:jns) {
					if(string.equals("1337") || string.equals("1235")) {
						zl = zl + 20000;
					}else {
						for(int gj : gjskillList) {
							if(string.equals(gj+"")) {
								zl = zl + 2500;
							}
						}
						for(int pt : ptskillList) {
							if(string.equals(pt+"")) {
								zl = zl + 1000;
							}
						}
					}
				}
			}
		}
		if(pet.getInnerGoods()!=null) {
            String[] sz = pet.getInnerGoods().split("\\|");
            if(sz.length>0) {
            	for(String z :sz) {
            		if(z!=null && !z.equals("")) {
            			Goodstable good2 = GoodsListFromServerUntil.getRgid(new BigDecimal(z));
            			if (good2 != null) {
            				if(good2.getValue()!=null && !good2.getValue().equals("")) {
            					String[] msgs = good2.getValue().split("\\|");
            					if(Integer.parseInt(msgs[2].split("=")[1].split("转")[0])>0) {
            						zl = zl + Integer.parseInt(msgs[2].split("=")[1].split("转")[0])*2000;
            					}
            					if(Integer.parseInt(msgs[2].split("=")[1].split("转")[1])>0) {
            						zl = zl + Integer.parseInt(msgs[2].split("=")[1].split("转")[1])*200;
            					}
            				}
            			}
            		}
            	}
            }
		}
		if(pet.getStye()!=null) {
            String[] sz = pet.getStye().split("\\|");
            if(sz.length>1) {
            	int jxj = 0;
            	String skill = "";
            	for(int i=0;i<sz.length;i++) {
            		if(sz[i].split("-").length>1) {
            			String z = sz[i].split("-")[1];
            			Goodstable good2 = GoodsListFromServerUntil.getRgid(new BigDecimal(z));
            			if (good2 != null) {
            				if(good2.getValue()!=null && !good2.getValue().equals("")) {
            					String[] msgs = good2.getValue().split("\\|");
            					if(Integer.parseInt(msgs[0].split("=")[1])>0) {
            						zl = zl + Integer.parseInt(msgs[0].split("=")[1])*5000;
            					}
            					for(String jx : msgs) {
            						if(jx.contains("觉醒技")) {
            							Double double1 = Double.parseDouble(jx.split("&")[2])*20;
            							if(double1>0) {
            								zl = (long) (zl + double1*200);
            							}
            							int dj = Integer.parseInt(jx.split("&")[3]);
            							if(dj>0) {
            								zl = (long) (zl + dj*5);
            							}
            							if(skill == "") {
            								skill = jx.split("&")[1];
            								jxj = jxj+1;
            							}else if(skill.equals(jx.split("&")[1])){
            								jxj = jxj+1;
            							}
            						}
            					}
            				}
            			}
            		}
            	}
            	if(jxj == 3) {
            		zl = zl + 5000;
            	}
            }
		}
//		if(DataUtil.isNotEmpty(pet.getOldPetSkin())) {
//			zl = zl+2000;
//			if(DataUtil.isNotEmpty(pet.getChangeAttribute()) && !pet.getChangeAttribute().equals("0|0|0|0")) {
//				String[] sw = pet.getChangeAttribute().split("\\|");
//				zl = zl+(Integer.parseInt(sw[0])/20);
//				zl = zl+(Integer.parseInt(sw[1])/20);
//				zl = zl+(Integer.parseInt(sw[2])/2);
//				zl = zl+(Integer.parseInt(sw[3])*5);
//			}
//		}
		return zl+"";
	}
	
	
}
